package top.rushpeak.edu03.websocket.util;

import java.util.ArrayList;

import org.apache.log4j.Logger;
import org.springframework.web.socket.WebSocketSession;

public class SessionManager {

	private static final Logger LOG = Logger.getLogger(SessionManager.class);
	
	private static volatile SessionManager sessionManager = new SessionManager();

	private ArrayList<WebSocketSession> users = new ArrayList<WebSocketSession>();
	
	private SessionManager() {
	}

	public static synchronized SessionManager instance() {
		return sessionManager;
	}
	

	public void put(WebSocketSession session) {

		users.add(session);
	}

	public void remove(WebSocketSession session) {

		users.remove(session);
	}
	
	public ArrayList<WebSocketSession> get(){
		
		return users;
	}
	
	

    
}
